$( document ).ready(function() { var time = 15; //время всплывания окна с ip в секундах; var timew = 30; //время всплывания попап в секундах; var intervalw = timew*1000; var DateTimer = new Date(); DateTimer = DateTimer.getTime(); setInterval(funcw,intervalw); function funcw () { var newDate = new Date() - intervalw; var nn = new Date(); nn = nn.getTime(); console.log('timer' + DateTimer); console.log('thiss' + newDate); console.log('this2' + nn); if (DateTimer < newDate) { $('.shadows').fadeIn(500); $('.popup').fadeIn(500); } } $('#myForm input').click(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm2 input').click(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm3 input').click(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm input').keyup(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm2 input').keyup(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm3 input').keyup(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm').mouseover(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm2').mouseover(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('#myForm3').mouseover(function(){ DateTimer = new Date(); DateTimer = DateTimer.getTime(); }); $('.navbar-toggle').click(); var elem = $('#bs-example-navbar-collapse-1'); var elem2 = $('.navbar-nav'); elem2.hide(); $('.navbar-toggle').click(function(){ elem.addClass('myToggle'); var disp = elem.attr('aria-expanded'); if (disp == 'false') { elem2.hide(); } else { elem2.show(); } }); $('#vopros').click(function(){ $('.shadows').show(); $('.popup').show(); setTimeout(funchide2,2000); }); $('#closed').click(function(){ $('.shadows').hide(); $('.popup').hide(); }); function randomInteger(min, max) { var rand = min + Math.random() * (max - min) rand = Math.round(rand); return rand; } function func () { var date = new Date (); var hours = date.getHours(); var minutes = date.getMinutes(); var times = hours + ':' + minutes; $('#time').text(times); //79.175.3.67 var num1 = randomInteger(10,99); var num2 = randomInteger(100,999); var num3 = randomInteger(1,9); var num4 = randomInteger(10,99); var ip = num1 +'.'+ num2 +'.'+ num3 +'.' + num4; $('#ip').text(ip); $('.ip').fadeIn(500); setTimeout(funchide,2000); } function funchide () { $('.ip').fadeOut(500); } var interval = time*1000; setInterval(func,interval); $('.btn-l').click(function(){ $('.btn-l').removeClass('active-b'); $(this).addClass('active-b'); return false; }); $('.btn-a').click(function(){ var text = $(this).text(); $('.btn-a').removeClass('active-b'); $(this).addClass('active-b'); if (text == 'Москва') { $('.disabcity input').attr('disabled','disabled'); $('.dopbl input').removeAttr('required'); } else { $('.disabcity input').removeAttr('disabled'); $('.dopbl input').attr('required','required'); } return false; }); $(".phone").mask("+7(999) 999-99-99"); $('#btn4').click(function(){ if ($('#form4 .radio').is(":checked")) { $('#form4').submit(); } else { ('#error4').text('Пожалуйста ознакомтесь с условиями доставки!'); } /* var prov = 0; $('#form4 input').each(function(){ if ($(this).val() == '') { prov = 1; } }); if (prov == 0) { $('#form4').submit(); } else { $('#error4').text('Пожалуйста заполните все поля!'); } */ return false; }); //$('#myForm').validator(); ( function($){ $.fn.shuffle = function() { return this.each(function(){ var items = $(this).children(); return (items.length) ? $(this).html($.shuffle(items,$(this))) : this; }); } $.fn.validate = function() { var res = false; this.each(function(){ var arr = $(this).children(); res = ((arr[0].innerHTML=="1")&& (arr[1].innerHTML=="2")&& (arr[2].innerHTML=="3")&& (arr[3].innerHTML=="4")&& (arr[4].innerHTML=="5")&& (arr[5].innerHTML=="6")); }); return res; } $.shuffle = function(arr,obj) { for( var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x ); if(arr[0].innerHTML=="1") obj.html($.shuffle(arr,obj)) else return arr; } })(jQuery); $(function() { $("#sortable").sortable(); $("#sortable").disableSelection(); $("#sortable2").sortable(); $("#sortable2").disableSelection(); $("#sortable3").sortable(); $("#sortable3").disableSelection(); $('ul').shuffle(); $("#btn1").click(function(){ ($('#sortable').validate()) ? $('#myForm').validator() : $('#error').text("не верно введена капча") return false; }); // $("#btn2").click(function(){ ($('#sortable2').validate()) ? $('#myForm2').validator() : $('#error2').text("не верно введена капча") return false; }); $("#btn3").click(function(){ ($('#sortable3').validate()) ? $('#myForm3').validator() : $('#error3').text("не верно введена капча") return false; }); }); });